/**
*
* Test changes made
**/

void deleteNode(item* *argHead)
{
	item *curr;
	item *prev=NULL;

	char msg[30];

	int find;

	printf("\n\nEnter Number to find: ");
	scanf("%d",&find);

	curr = *argHead;

	while((curr->val != find) && (curr->next != NULL))
	{
		prev= curr;
		curr = curr->next;
	}

	if(curr->val != find)
	{
		// target not found
		strcpy(msg,"not Found\n");
	}
	else
	{
		// target found
		if(prev == NULL)
		{
			*argHead = curr->next;
			free(curr);
		}
		else
		{
			prev->next = curr->next;
			free(curr);
		}
		
		
		strcpy(msg," Found and Deleted");
	}

	printf("\nNode %d %s \n\n",find,msg);
	scanf("%*c");
}

void addNode(item* *argHead)
{
	item *newNode;
	int value;

	//allocate space in memory
	newNode = (item*) malloc(sizeof(item));
	newNode->next = *argHead;

	printf("\nEnter value for Node: ");
	scanf("%d%*c",&value);
	newNode->val = value;

	// head now points to new node	
	*argHead= newNode;
	printf("\n\nNew Node %d added\n\n",value);
}

void printList(item* head)
{
	printf("\n");
	item* temp = head;
	while(temp!=NULL)
	{
		printf(" %d\n",temp->val);
		temp = temp->next;
	}
	printf("\n");
}

int Length(item* head) 
{
	int count = 0;
	item* current = head;
	while (current != NULL) 
	{
		count++;
		current=current->next;
	}
	return(count);
}